package org.jeecg.config;

import org.apache.commons.lang3.StringUtils;
import org.jeecg.config.interceptor.OrgPermissionInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.RequestContextListener;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author chensherun on 2023/4/19.
 * @version 1.0
 */
@Configuration
public class FkBackWebMvcConfiguration implements WebMvcConfigurer {

    @Autowired
    private OrgPermissionInterceptor orgPermissionInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(orgPermissionInterceptor).addPathPatterns("/**");
    }

    @Bean
    public RequestContextListener requestContextListener(){
        return new RequestContextListener();
    }
}
